<?php
/**
 * Created by PhpStorm.
 * User: Edward
 * Date: 2019/6/3
 * Time: 9:07
 */

namespace app\admin\controller\shop;


use app\admin\BaseController;
use app\admin\model\ShopType as Type;
use app\lib\exception\NotFoundException;

class ShopType extends BaseController {
    /**
     * 获取商家类型
     * @return \think\response\Json
     * @throws NotFoundException
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function shopTypeAll(){
        $type = Type::shopType()->toArray();
        if(empty($type)){
            throw new NotFoundException([ 'msg' => '暂无商家分类']);
        }
        return writeJson(200,['type'=>$type]);
    }
}